<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>紧邻兄弟元素选择器</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
        }

        main {
            padding: 2rem;
            width: 1200px;
            background-color: #EEEEEE;
        }

        main div {
            margin-left: 1rem;
        }

        main div+h2 {
            color: red;
        }
    </style>
</head>

<body>
    <main>
        <h1>紧邻兄弟元素选择器</h1>
        <p>紧邻兄弟元素选择器可以选择紧接着某个元素的兄弟元素。</p>
        <h2>h2元素</h2>
        <div>
            <h3 name="houdunren">后盾人编程</h3>
            <aside>
                <h2>aside元素中的孙级元素h2</h2>
            </aside>
            <h1>孙级元素</h1>
        </div>
        <h2 name="hdcms.com">直接相邻的h2兄弟元素</h2>
        <h2>h2兄弟元素</h2>
        <h1>h1兄弟元素</h1>
    </main>
</body>

</html>